package com.deyuanyun.pic.ctrl.enumeration;

/**
 * 任务检测频率枚举
 *
 * @author axiao(xj08.dream@gmail.com)
 * @version 1.0
 *          Histroy: [修改人][时间][描述]
 * @date 2016-09-06
 */
public enum PlanInspectionFrequency {
    /**
     * 每天/1天
     */
    EVERY_DAY,
    /**
     * 1周
     */
    WEEKLY,
    /**
     * 两周
     */
    TWO_WEEK,
    /**
     * 1月
     */
    MONTHLY,
    /**
     * 2月
     */
    TWO_MONTH,
    /**
     * 3月
     */
    THREE_MONTH,
    /**
     * 6月
     */
    SIX_MONTH,
    /**
     * 1年
     */
    ANNUALLY;


    /**
     * 根据枚举字符串获取到枚举，取不到的时候默认为“每年”
     * @param str
     * @return
     */
    public static PlanInspectionFrequency getInstance(String str) {
        PlanInspectionFrequency[] frequencies = PlanInspectionFrequency.values();
        for (PlanInspectionFrequency frequency : frequencies) {
            if(frequency.name().equals(str)) {
                return frequency;
            }
        }
        return PlanInspectionFrequency.ANNUALLY;
    }

}
